﻿@using RooHui.Infrastructure.Entities.Entity;
@using RooHui.Infrastructure.Entities.Enum
@using RooHui.Tool
@{
    ViewBag.Title = "ProjectPublish";
    Layout = "~/Views/Shared/_Base.cshtml";



    Project project = ViewBag.project;

    List<ProcessDoingHistory> processDoingHistoryList = ViewBag.processDoingHistoryList;
    List<RepaymentPlan> repaymentPlanList = ViewBag.repaymentPlanList;
    Policy policy = project.PolicyList.FirstOrDefault(c => !c.IsAttach);
    int cycleAmount = policy.CycleAmount;
    if (policy.CycleAmount == 0)
    {
        cycleAmount = project.CycleAmount;
    }
    decimal monthcount = 0m;
    if (policy.DurationType == DurationType.ByDay)
    {
        monthcount = Math.Round((((decimal)(cycleAmount * policy.Duration)) / 365) * 12, 2, MidpointRounding.AwayFromZero);
    }
    else
    {
        monthcount = cycleAmount * policy.Duration;
    }

    decimal reward = repaymentPlanList.Where(c => c.Policy.IsAttach).ToList().Sum(c => c.RepaymentInterest);
    decimal profits = Math.Round((project.Financing * (project.OriginalRate - project.GuaranteeRate - policy.Rate) / 100) * (monthcount / 12), 2, MidpointRounding.AwayFromZero);
    decimal lastprofits = profits - reward;
}
@section head{
     
}
<form action="/" method="post" id="frmPublish" name="frmPublish" style="background-color: white;">
<div class="liger-form" style="padding-top: 5px">
    <table cellpadding="0" cellspacing="0" class="l-table-edit" width="600">
        <tr>
            <td align="right" class="l-table-edit-td">
                <strong>
                    <h3>
                        开户信息</h3>
                </strong>
            </td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td" width="100">
                <span class="l-star">*</span>&nbsp;用户名:
            </td>
            <td align="left" class="l-table-edit-td" width="200">
                <input name="txtAgentName" type="text" id="txtAgentName" validate="{required:true}" />
            </td>
            <td align="right" class="l-table-edit-td" width="100">
                <span class="l-star">*</span>&nbsp;真实姓名:
            </td>
            <td align="left" class="l-table-edit-td" width="200">
                <input name="txtRealName" type="text" id="txtRealName" validate="{required:true}" />
            </td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td">
                <span class="l-star">*</span>&nbsp;身份证号:
            </td>
            <td align="left" class="l-table-edit-td">
                <input name="txtAgentIDNO" type="text" id="txtAgentIDNO" validate="{required:true}" />
            </td>
            <td align="right" class="l-table-edit-td">
                <span class="l-star">*</span>&nbsp;手机号码:
            </td>
            <td align="left" class="l-table-edit-td">
                <input name="txtAgentHandPhone" type="text" id="txtAgentHandPhone" validate="{required:true}" />
            </td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td">
                <span class="l-star">*</span>&nbsp;居住地址:
            </td>
            <td align="left" class="l-table-edit-td" colspan="3">
                <input name="txtAddress" type="text" id="txtAddress" ligerui="width:490" style="width: 490"
                    validate="{required:true}" />
            </td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td">
                <strong>
                    <h3>
                        时间控制</h3>
                </strong>
            </td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td" width="100">
                <span class="l-star">*</span>&nbsp;发布时间:
            </td>
            <td align="left" class="l-table-edit-td" width="200">
                <input name="txtDate" type="text" id="txtDate" ltype="date" validate="{required:true}" />
            </td>
            <td align="right" class="l-table-edit-td" width="100">
                <span class="l-star">*</span>&nbsp;投资起息日:
            </td>
            <td align="left" class="l-table-edit-td" width="200">
                <input name="txtDate" type="text" id="txtDate" ltype="date" validate="{required:true}" />
            </td>
        </tr>
         <tr>
            <td align="right" class="l-table-edit-td" width="100">
                 
            </td>
            <td align="left" class="l-table-edit-td" width="200">
                 
            </td>
            <td align="right" class="l-table-edit-td" width="100">
                <span class="l-star">*</span>&nbsp;借款计息日:
            </td>
            <td align="left" class="l-table-edit-td" width="200">
                <input name="txtDate" type="text" id="txtDate" ltype="date" validate="{required:true}" />
            </td>
        </tr>
        <tr>
            <td align="center" colspan="4">
                <input type="button" value="发布" id="btnSave" class="l-button" />&nbsp;&nbsp;<input
                    type="button" value="取消" id="btnCancel" class="l-button" />
            </td>
        </tr>
    </table>
</div>
</form>
